import request from '@/utils/request'

/**
 *
 * 获取组织架构数据
 */
export const getDepartments = () => {
  return request({
    url: '/company/department'
  })
}

/**
 *
 * 根据部门id删除部门
 */
export const delDepartments = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

/**
 * 新增部门接口
 */
export const addDepartments = (data) => {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 *
 * 根据id查询部门详情
 */
export const getDepartDetail = (id) => {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 *
 * 编辑部门
 */
export const updateDepartments = (data) => {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
